﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PMS.Client.Entities;
using PMS.Client.IDAL;

namespace PMS.Client.DAL
{
    public class FeeAccess : WebAccess, IFeeAccess
    {
        public FeeAccess(GlobalValues globalValues) : base(globalValues)
        {
        }

        public string GetFeePage(string key, int index, int size)
        {
            key = string.IsNullOrEmpty(key) ? "none" : key;
            string uri = $"/api/fee/page/{key}/{index}/{size}";
            return this.Get(uri);
        }

        public string GetFeeModes()
        {
            string uri = $"/api/fee/feemode";
            return this.Get(uri);
        }

        public string UpdateFee(string feeJson)
        {
            string uri = "/api/fee/update";

            StringContent content = new StringContent(feeJson);
            content.Headers.ContentType =
                new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

            return this.Post(uri, content);
        }

        public string DeleteFee(int id)
        {
            string uri= $"/api/fee/delete/{id}";
            return this.Get(uri);
        }

        public string ChangeState(int id, int state)
        {
            string uri = $"/api/fee/state/{id}/{state}";
            return this.Get(uri);
        }
    }
}
